<script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery-1.8.2.js" type="text/javascript"></script>
<script type="text/javascript">
window.onready = function() {

	 $('#btthongke').click(function () {
        var url = "<?php print $this->createUrl('sanpham/tonkho',array('idkho'=>''));?>";
        url = url +  $('#idkho').val();
        $("main-form").attr("action", url);
        $("main-form").submit();
       });
	}
</script>

<?php 

$this->pageTitle=Yii::app()->name . ' - Thống kê tồn kho';
$this->breadcrumbs=array(
	'Danh sách sản phẩm'=>array('sanpham/index'),'Thống kê tồn kho',
);
?>
<form method='get' id='main-form'>

<?php 

 echo '<p>Chọn kho: '. CHtml::dropDownList('idkho','idkho', $khos).  CHtml::submitButton('Thống kê'); 
 echo '</p>';
?>
</form>

<?php 
 $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>new CArrayDataProvider($list, array()),
 'enablePagination'=>false,
	'enableHistory'=>false,
	'summaryText'=>'',
 'columns'=>array(
 	array(
        'header'=>'STT',
        'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
      ),
    array('name'=>'idkho', 'header'=>'Tên kho', 'value'=> '$data->tbkhohang->tenkho'),
     array('name'=>'idsanpham', 'header'=>'Tên sản phẩm', 'value'=> '$data->tbsanpham->tensanpham'),
     array('name'=>'soluongtonkho', 'header'=>'Số lượng tồn'),
    array(
      'class'=>'CButtonColumn',
    ),
  ),
 )); 

?>